package com.jinyu.dao.entity.sys;

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import org.hibernate.validator.constraints.Length;

import java.io.Serial;
import java.io.Serializable;

/**
 * @Author: yangli
 * @Despriction:    用户基本信息
 * @Package: com.jinyu.admin.controller.sys
 * @Date:Created in 2022/5/3 22:03
 * @Modify By:
 */

public class SysUser implements Serializable {

    @Serial
    private static final long serialVersionUID = 5493046273545328522L;

    /**
     * 主键
     */
    private long id;

    /**
     * 用户编码
     */
    @NotNull(message = "用户编码不能为空")
    @Pattern(regexp = "^(?!_)(?!.*?_$)[0-9a-zA-Z_]{1,20}$",message = "用户编码必须是由英文、数字、下划线组成，且下划线不能在头部或者末尾")
    private String userCode;

    /**
     * 用户名称
     */
    @Pattern(regexp = "^(?!_)(?!.*?_$)[0-9a-zA-Z_\\u4e00-\\u9fa5]{1,20}$",message = "用户名称必须是由汉字、英文、数字、下划线组成，且下划线不能在头部或者末尾")
    private String userName;

    /**
     * 密码
     */
    @NotNull(message = "密码不能为空")
    @Length(min = 6,max = 20,message = "长度至少6位，至多20位")
    private String passWord;

    /**
     * 部门id
     */
    private Long deptId;

    /**
     * 性别(0:女；1:男)
     */
    private Integer sex = 1;

    /**
     * 手机号，不加区号
     */
    private String mobile;

    /**
     * 座机
     */
    private String landline;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 身份证号
     */
    @Pattern(regexp = "(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)",message = "非法身份证")
    private String idCard;

    /**
     * 地址
     */
    private String address;

    /**
     * 是否启用(0：禁用；1：启用)
     */
    private Integer enabled = 1;

    /**
     * 创建时间
     */
    private String createTime;

    /**
     * 创建人
     */
    private String createUser;

    /**
     * 修改时间
     */
    private String updateTime;

    /**
     * 修改人
     */
    private String updateUser;

    /**
     * 删除标志(0：未删除；1：已删除)
     */
    private Integer delFlag = 0;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "SysUser{" +
                "id='" + id + '\'' +
                ", userCode='" + userCode + '\'' +
                ", username='" + userName + '\'' +
                ", password='" + passWord + '\'' +
                ", deptId=" + deptId +
                ", sex=" + sex +
                ", mobile='" + mobile + '\'' +
                ", landline='" + landline + '\'' +
                ", email='" + email + '\'' +
                ", idCard='" + idCard + '\'' +
                ", address='" + address + '\'' +
                ", enabled=" + enabled +
                ", createTime='" + createTime + '\'' +
                ", createUser='" + createUser + '\'' +
                ", updateTime='" + updateTime + '\'' +
                ", updateUser='" + updateUser + '\'' +
                ", delFlag=" + delFlag +
                '}';
    }

    public String getUserCode() {
        return userCode;
    }

    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getLandline() {
        return landline;
    }

    public void setLandline(String landline) {
        this.landline = landline;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Integer getEnabled() {
        return enabled;
    }

    public void setEnabled(Integer enabled) {
        this.enabled = enabled;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public String getUpdateUser() {
        return updateUser;
    }

    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }

    public Integer getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(Integer delFlag) {
        this.delFlag = delFlag;
    }
}
